package com.atguigu.yygh.hosp.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.hosp.service.HospitalSetService;
import com.atguigu.yygh.model.hosp.HospitalSet;
import com.sun.org.apache.regexp.internal.RE;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName:HospitalSetController
 * Package:com.atguigu.yygh.hosp.controller
 * Description: 描述信息
 *
 * @date:2021/7/20 20:02
 * @author:Aimer
 */
@Api(tags = "医院设置管理")
@RestController
@RequestMapping("/hospset")
public class HospitalSetController {

    @Autowired
    private HospitalSetService hospitalSetService;

    //查询所有的医院
    @GetMapping("/getAll")
    @ApiOperation(value = "获取所有医院设置")
    public Result queryAll(){
        List<HospitalSet> list = hospitalSetService.list();
        return Result.ok(list);
    }

    //根据id逻辑删除医院信息
    @DeleteMapping("{id}")
    @ApiOperation(value = "逻辑删除医院信息")
    public Result deleteById(@PathVariable Long id){
        boolean result = hospitalSetService.removeById(id);
        if (result) {
            return Result.ok();
        }else{
            return Result.fail();
        }
    }
}
